package com.rpj.dao;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.rpj.entity.TeaEntity;

public interface TeaDao extends JpaRepository<TeaEntity, String>,JpaSpecificationExecutor<TeaEntity>{
@Query(value="select * from teachers order by teaid asc ",nativeQuery=true)
public List<TeaEntity> query();
@Modifying 
@Transactional 
@Query(value ="update teachers set teaname=?1,teapassword=?2,teadept=?3,status=?4,teaborrowbooknum=?5,teaborrowmaxnum=?6,teagivebooknum=?7,data1=?8,data2=?9,data3=?10 where teaid=?11 ",nativeQuery = true)
int updateTea(String teaname,String teapassword,String teadept,String status,String teaborrowbooknum,String teaborrowmaxnum,String teagivebooknum,String data1,String data2,String data3,String teaid);
//查询部门
@Query(value="select teadept from teachers GROUP BY teadept",nativeQuery=true)
List<String> querydept();
//登陆查询
@Query(value="select * from teachers where teaname=?1 and teapassword=?2",nativeQuery=true)
TeaEntity tealogin(String teaname,String teapassword);
}
